package com.hundredhealth.rose.util;

public class ExecutionError {

    private String message;

    private Throwable throwable;

    public ExecutionError(String message) {
        this.message = message;
    }

    public ExecutionError(Throwable throwable, String defaultMessage) {
        if (throwable != null) {
            this.message = throwable.getLocalizedMessage();
        }

        if (this.message == null) {
            this.message = defaultMessage;
        }
        this.throwable = throwable;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Throwable getThrowable() {
        return throwable;
    }

    public void setThrowable(Throwable throwable) {
        this.throwable = throwable;
    }

}
